package com.yenlien.traceyun.business.entity;


import javax.persistence.*;

/**
 * Created by LiuSha on 2020/7/1.
 * 产品介绍
 */
@Entity
@Table(name = "t_product")
public class Product extends TraceEntity {
    @Column
    private String title; //产品标题
    @Column
    private String img; //产品图片
    @Column
    private String relatedProducts; //关联产品
    @Column
    private String quality; //保质期
    @Column
    private String link; //电商链接
    @Column
    @Lob
    private String introduce; //介绍
    @Transient
    private String query; //查询字段

    @Transient
    private String outDate; //过期时间

    public String getOutDate() {
        return outDate;
    }

    public void setOutDate(String outDate) {
        this.outDate = outDate;
    }

    public String getQuery() {
        return query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    public String getRelatedProducts() {
        return relatedProducts;
    }

    public void setRelatedProducts(String relatedProducts) {
        this.relatedProducts = relatedProducts;
    }

    public String getQuality() {
        return quality;
    }

    public void setQuality(String quality) {
        this.quality = quality;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getIntroduce() {
        return introduce;
    }

    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }

    public void setImg(String originalFilename, String newName) throws IllegalAccessException {
        if (this.getImg() != null && this.getImg().contains(originalFilename)) {
            this.setImg(this.getImg().replace(originalFilename, newName));
        }
    }

}
